package com.csdn.leon.fragment;

import java.util.HashMap;

import android.support.v4.app.Fragment;

public class MyFragmentManager {

	public static MyFragmentManager instance;
	public HashMap<Integer, Fragment> map = new HashMap<Integer, Fragment>();

	public MyFragmentManager() {

	}

	public static MyFragmentManager getInstance() {
		if (instance == null) {
			instance = new MyFragmentManager();

		}
		return instance;
	}

	public BaseFragment getFragment(int id) {
		BaseFragment fragment = null;
		switch (id) {
		case 0:
			fragment = new HomeFragment();
			break;
		case 1:
			fragment = new FindFragment();
			break;
		case 2:
			fragment = new SettingFragment();
			break;
		case 3:
			fragment = new SettingFragment();
			break;
		}
		map.put(id, fragment);
		return fragment;
	}
	
}
